{include file="public/header"}
<div class="pub_wid notice_cont ent_cont">
    <div class="notice_left bgb lf" id="enterpriseDetail">
        <h1>企业库<span>当前位置：<a href="#">主页</a>><a href="/index/enterprise/index">企业库</a>><a href="#">正文</a></span></h1>
        <h2>公司简介</h2>
        <div class="widthauto ent_detail">
            <div class="ent_de_box widthauto">
                <ul class="ula">
                    <li><b>{{memberInfo.name}}</b></li>
                    <li><img src="/static/index/public/images/ent_one.png" /><span>企业类型：</span><span v-if="memberInfo.member_category == 2"><span v-if="memberInfo.member_grade!=2">普通物流企业（待升级）</span><i v-if="memberInfo.member_grade==2">[VIP物流企业]</i></span><b v-if="memberInfo.member_category == 1">[货主企业]</b></li>
                    <li><img src="/static/index/public/images/ent_two.png" /><span>注册资本：</span>{{memberInfo.fund}}万元</li>
                    <li><img src="/static/index/public/images/ent_thr.png" /><span>注册时间：</span>{{memberInfo.company_time}}</li>
                    <li><img src="/static/index/public/images/ent_four.png" /><span>所&nbsp;&nbsp;在&nbsp;&nbsp;地：</span>{{memberInfo.address}}</li>
                    <li><img src="/static/index/public/images/ent_fiv.png" /><span>详细地址：</span>{{memberInfo.home_address}}</li>
                    <li><img src="/static/index/public/images/ent_six.png" /><span>官方网址：</span>{{memberInfo.website_url}}</li>
                    <li><img src="/static/index/public/images/ent_sev.png" /><span>企业简介：</span></li>
                </ul>
                <p>
                    {{memberInfo.company_info}}
                </p>

                <div class="ent_logo"><img style="width: 302px;height: 151px" :src="memberInfo.logo" /></div>
            </div>
            <h3>联系方式</h3>
            <div class="ent_de_box widthauto" v-if="isShow && memberInfo.member_category==1">
                <ul class="ulb">
                    <li><img src="/static/index/public/images/ent_ten.png" /><span>联&nbsp;系&nbsp;人：</span>{{memberInfo.contacts}}</li>
                    <li><img src="/static/index/public/images/ent_eig.png" /><span>职&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;位：</span>{{memberInfo.position}}</li>
                    <li><img src="/static/index/public/images/ent_nine.png" /><span>手&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;机：</span>{{memberInfo.mobile}}</li>
                </ul>
                <ul class="ulb">
                    <li><img src="/static/index/public/images/ent_tel.png" /><span>固定电话：</span>{{memberInfo.landine_phone}}</li>
                    <li><img src="/static/index/public/images/ent_ema.png" /><span>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱：</span>{{memberInfo.email}}</li>
                    <li><img src="/static/index/public/images/ent_wec.png" /><span>微&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;信：</span>{{memberInfo.wechat}}</li>
                </ul>
            </div>
            <div class="ent_de_box widthauto" v-else>
                <div class="tips tipa" v-if="memberInfo.member_category==1">联系方式，仅对VIP会员开放。如需查看详细内容，请升级成为VIP会员</div>
                <div class="tips tipa" v-if="memberInfo.member_category==2">请先注册并完成货主企业认证，进入运力服务商或报名情况查看企业详情</div>
            </div>
            <h3>其他信息</h3>
            <div class="ent_de_box widthauto" v-if="isShow && memberInfo.member_category==1">
                <ul class="ula" v-if="memberInfo.member_category==2">
                    <li><img src="/static/index/public/images/ent_lei.png" /><span>服务类型：</span><a href="#">运输服务</a><a href="#">仓储服务</a></li>
                    <li><img src="/static/index/public/images/ent_yun.png" /><span>自有运力：</span>{{supplement.self_car}}辆车<span>外协车辆：</span>{{supplement.subordinate_car}}辆车</li>
                    <li><img src="/static/index/public/images/ent_gua.png" /><span>挂靠情况：自购占比：</span>{{supplement.self_buying}}%<span>挂靠占比：</span>{{supplement.subordinate_buying}}%</li>
                    <li><img src="/static/index/public/images/ent_line.png" /><span>长跑路线：</span>{{supplement.line}}</li>
                    <li><img src="/static/index/public/images/ent_zhi.png" /><span>资质概况：</span><a href="#">道路运输证</a><a href="#">危化品运输证</a><a href="#">大件运输证</a></li>
                    <li><img src="/static/index/public/images/ent_anli.png" /><span>客户案例：</span>{{supplement.case}}</li>
                </ul>
                <ul class="ula" v-if="memberInfo.member_category==1">
                    <li><img src="/static/index/public/images/ent_hang.png" /><span>所属行业：</span>{{supplement.trade_name}}</li>
                    <li><img src="/static/index/public/images/ent_suan.png" /><span>预算金额：</span>{{supplement.budget}}万/年</li>
                    <li><img src="/static/index/public/images/ent_liang.png" /><span>发&nbsp;货&nbsp;量：</span>{{supplement.shipment}}万吨</li>
                    <li><img src="/static/index/public/images/ent_lu.png" /><span>主要线路：</span>{{supplement.line}}</li>
                    <li><img src="/static/index/public/images/ent_yao.png" /><span>服务要求：</span></li>
                </ul>
                <ul class="ulc" v-if="memberInfo.member_category==1">
                    <li>{{supplement.service_content}}</li>
                </ul>
                <h4 v-if="isAdd && memberInfo.member_category==1" class="widthauto">成为其运力服务商
                    <button @click="join(memberInfo)">立即申请</button>
                </h4>
                <h4 v-if="!isAdd && memberInfo.member_category==1" class="widthauto">已经申请过该企业
                </h4>
            </div>
<!--            <div class="ent_de_box widthauto">-->
<!--                <div class="tips tipa">请先注册并完成货主企业认证，进入运力服务商或报名情况查看企业详情</div>-->
<!--            </div>-->
            <div class="ent_de_box widthauto" v-else>
                <div class="tips tipa" v-if="memberInfo.member_category==2"> 请先注册并完成货主企业认证，进入运力服务商或报名情况查看企业详情</div>
                <div class="tips" v-if="memberInfo.member_category==1">项目详情，仅对VIP会员开放。如需查看详情内容，请升级成为VIP会员，已注册VIP会员请登录后查看。<br />
                    也可添加下方客服微信详细咨询。</div>
                <div class="tips"><img src="/static/index/public/images/wechat.jpg" /></div>
            </div>
        </div>
    </div>
    {include file="public/right"}
</div>
{include file="public/footer"}

<script>
    var id = "{$id}"
    var enterpriseDetailVm = new Vue({
        el:'#enterpriseDetail',
        data:{
            id:id,
            memberInfo:{},
            supplement:{},
            member_id:'',
            isShow:false,
            isAdd:true
        },
        methods:{
            getEnterpriseDetail:function () {
                var el = this
                var postData = {
                    "id":el.id,
                    'member_id':el.member_id
                }
                AjaxPost(postData,'/index/enterprise/getDetail').then((response=>{
                    var data = response.result
                    if(data.memberInfo){
                        el.memberInfo = data.memberInfo
                        el.isApplyAdd(el.memberInfo)
                    }
                    if(data.supplement){
                        el.supplement = data.supplement
                    }
                    console.log(response)
                })).catch(()=>{
                    setTimeout(()=>{
                        window.history.back()
                    },1000)

                })
            },
            join:function (memberInfo) {
                var el  = this
                if(el.member_id == ''){
                    $.customToastr('warning','请先登录')
                }
                if(localStorage.getItem('member_category')){
                    if(localStorage.getItem('member_category')==2){
                        var postData = {
                            'member_id':el.member_id,//要加入运力服务商的member_id（物流企业member_id）
                            'member_info_id':memberInfo.member_id,//有运力服务商的物流企业member_id
                            'member_info_name':memberInfo.name,//有运力服务商的物流企业member_id
                        }
                        AjaxPost(postData,'/index/enterprise/pushFacilitator').then((response=>{
                            if(response.status==1){
                                $.customToastr('success','加入成功，审核后查看')
                                setTimeout(()=>{
                                    window.history.go(-1)
                                },1000)
                            }
                        }))
                    }else {
                        $.customToastr('warning','只能物流企业才能申请')
                    }
                }else{
                    $.customToastr('warning','请等待审核通过，才能申请')
                }
            },
            isApplyAdd:function (memberInfo) {
                var el = this
                postData = {
                    'member_id':el.member_id,//要加入运力服务商的member_id（物流企业member_id）
                    'member_info_id':memberInfo.member_id,//有运力服务商的物流企业member_id
                }
                AjaxPost(postData,'/index/enterprise/isApplyAdd').then((response=>{
                    if(response.result){
                        el.isAdd = !response.result
                    }

                }))
            }
        },
        mounted(){
            this.$nextTick(function () {

                if(localStorage.getItem('member_category')){
                    this.member_id = localStorage.getItem('memberId')
                    if(localStorage.getItem('member_category')==2&&localStorage.getItem('member_grade')==2){
                        this.isShow = true
                    }
                }
                this.getEnterpriseDetail()

            })
        }
    })
</script>